<?php

namespace App\Dao;

use App\Model\UserSuperVip;
use App\Model\UserVip;
use Hyperf\Context\ApplicationContext;

class UserVipDao
{
    private static $instance;

    public static function getInstance()
    {
        if (!self::$instance) {
            self::$instance = Applicationcontext::getcontainer()->get(self::class);
        }
        return self::$instance;
    }


    /**
     * Note - 获取用户 vip|| svip信息
     * DateTime 2024/8/9 10:05
     * User Admin
     * @param $type 1-vip;2-svip
     * @param $uid
     * @return array
     */
    public function getVipInfo($type, $uid)
    {
        $data = [];
        if ($type == 1) {
            $data = UserVip::where("uid", $uid)->first();
        } elseif ($type == 2) {
            $data = UserSuperVip::where('uid', $uid)->first();

        }
        return modelToArray($data);
    }

}